<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">


	<bean id="hibernateSessionFactory"
		class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
		<property name="dataSource" ref="dataSource" />
<!--		<property name="configLocation" value="classpath:hibernate.cfg.xml"/>-->
		<property name="annotatedClasses">
			<list>
				<value>pms.om.Event</value>
				<value>pms.om.Theater</value>
				<value>pms.om.Reservierung</value>
				<value>pms.om.Kunde</value>
			</list>
		</property>
		<property name="hibernateProperties">
			<props>
				<prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
				<prop key="hibernate.hbm2ddl.auto">update</prop>
				<!--<prop key="hibernate.hbm2ddl.auto">create</prop>-->
				<prop key="hibernate.show_sql">true</prop>
				<prop key="hibernate.cache.provider_class">org.hibernate.cache.NoCacheProvider</prop>
			</props>
		</property>
	</bean>
	
	<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
		<property name="sessionFactory" ref="hibernateSessionFactory" />
	</bean>
	
	<!-- ******************* -->
	<!-- Data Access Objekte -->
	<!-- ******************* -->
	
	<bean id="kundeDao" class="pms.dao.KundeDao">
		<property name="sessionFactory" ref="hibernateSessionFactory" />
	</bean>
	
	<bean id="theaterDao" class="pms.dao.TheaterDao">
		<property name="sessionFactory" ref="hibernateSessionFactory" />
	</bean>
	
	<bean id="eventDao" class="pms.dao.EventDao">
		<property name="sessionFactory" ref="hibernateSessionFactory" />
		<property name="theaterDao" ref="theaterDao" />
	</bean>
	
	<bean id="reservierungDao" class="pms.dao.ReservierungDao">
		<property name="sessionFactory" ref="hibernateSessionFactory" />
	</bean>

	<!-- ************** -->
	<!-- Die Controller -->
	<!-- ************** -->
	
	<bean name="HomeCo" class="pms.controller.Home" />
	
	<bean name="LogoutCo" class="pms.controller.Logout" />

	<bean name="AlleEventsCo" class="pms.controller.AlleEvents">
		<property name="eventDao" ref="eventDao"/>
	</bean>
	
	<bean name="AlleTheaterCo" class="pms.controller.AlleTheater">
		<property name="theaterDao" ref="theaterDao"/>
	</bean>
	
	<bean name="AlleKundenCo" class="pms.controller.AlleKunden">
		<property name="kundeDao" ref="kundeDao"/>
	</bean>
	
	<bean name="AlleReservierungenCo" class="pms.controller.AlleReservierungen">
		<property name="reservierungDao" ref="reservierungDao"/>
	</bean>
	
	<bean name="AlleBuchungenCo" class="pms.controller.AlleBuchungen">
		<property name="reservierungDao" ref="reservierungDao"/>
	</bean>
		
	<bean name="LoescheResCo" class="pms.controller.LoescheRes">
		<property name="reservierungDao" ref="reservierungDao"/>
	</bean>	
	
	<bean name="NeuesEventCo" class="pms.controller.EditEvent">
		<property name="eventDao" ref="eventDao"/>
		<property name="theaterDao" ref="theaterDao"/>
	</bean>
	
	<bean name="NeuerKundeCo" class="pms.controller.EditKunde">
		<property name="eventDao" ref="eventDao"/>
		<property name="kundeDao" ref="kundeDao"/>	
	</bean>
	
	<bean name="NeuesTheaterCo" class="pms.controller.EditTheater">
		<property name="theaterDao" ref="theaterDao"/>
	</bean>
		
	<bean name="SaveEventCo" class="pms.controller.SaveEvent">
		<property name="eventDao" ref="eventDao"/>
	</bean>
	
	<bean name="SaveReservierungCo" class="pms.controller.SaveReservierung">
		<property name="reservierungDao" ref="reservierungDao"/>
		<property name="kundeDao" ref="kundeDao"/>
	</bean>
	
	<bean name="SaveReservierungNowCo" class="pms.controller.SaveReservierungNow">
		<property name="reservierungDao" ref="reservierungDao"/>
		<property name="eventDao" ref="eventDao"/>
		<property name="kundeDao" ref="kundeDao"/>
	</bean>
	
	<bean name="SaveTheaterCo" class="pms.controller.SaveTheater">
		<property name="theaterDao" ref="theaterDao"/>
	</bean>
	
	<bean name="ShowTheaterCo" class="pms.controller.ShowTheater">
		<property name="theaterDao" ref="theaterDao"/>
	</bean>
	
</beans>
